package com.wuyan.locationdog.help

import com.arcsoft.commonbase.bean.DeviceBeanContent
import com.arcsoft.commonbase.bean.DeviceShareBeanContent
import com.arcsoft.commonbase.bean.DeviceShareCustomBean
import com.arcsoft.commonbase.bean.OrderListBeanContent
import com.arcsoft.commonbase.bean.SuccessBean
import com.arcsoft.commonbase.bean.TrackBeanContent

object DeviceHelp {
    lateinit var selectDeviceBeanContent: DeviceBeanContent

    lateinit var successBean: SuccessBean


    //分享
    lateinit var deviceShareBeanContent: DeviceShareBeanContent
    lateinit var deviceShareList: MutableList<DeviceShareCustomBean>

    //轨迹
    lateinit var startTime: String
    lateinit var endTime: String
    lateinit var instantTrackBeanContent: TrackBeanContent

    //是否是设备修改密码
    var isDeviceModifyPwd: Boolean = false


    lateinit var instantOrderListBeanContent: OrderListBeanContent


    var addDeviceName: String = ""
    var addDeviceUsageType: Int = 1


    lateinit var areaMap: HashMap<String, Any>

    fun getDeviceName(deviceBeanContent: DeviceBeanContent): String {
        if (deviceBeanContent.dog?.dogName.isNullOrEmpty()) {
            return deviceBeanContent.deviceDetailVO.deviceName
        }
        return deviceBeanContent.dog?.dogName.toString()
    }

    fun getDeviceName(deviceBeanContent: DeviceShareBeanContent): String {
        if (deviceBeanContent.dogName.isNullOrEmpty()) {
            return deviceBeanContent.deviceName
        }
        return deviceBeanContent.dogName.toString()
    }

    fun getDeviceName(deviceBeanContent: OrderListBeanContent): String {
        if (deviceBeanContent.dogDO?.dogName.isNullOrEmpty()) {
            return deviceBeanContent.deviceName
        }
        return deviceBeanContent.dogDO?.dogName.toString()
    }

    fun getDeviceUrl(deviceBeanContent: DeviceShareBeanContent): String {
        if (deviceBeanContent.dogImg.isNullOrEmpty()) {
            return deviceBeanContent.deviceAvatarUrl
        }
        return deviceBeanContent.dogName.toString()
    }

    /**
     * 是否共享设备
     */
    //团队会空 反向判断一下
    fun isShare() = DeviceHelp.selectDeviceBeanContent.deviceDetailVO.bindType != 1
}